<template>
  <div>
    <van-search
      v-model="value"
      background="red"
      shape="round"
      show-action
      placeholder="请输入搜索关键词"
      @click-input="onSearch"
    >
      <template #left>
        <div @click="GO">地址</div>
      </template>
      <template #action>
        <div @click="GO">
          <span v-if="flag === 0">登录</span>
          <span v-else>我的</span>
        </div>
      </template>
    </van-search>
  </div>
</template>

<script>
export default {
  props:['flag'], // 0 登录  1 我的
  data() {
    return {
      value: "",
      // flag:0,
    };
  },
  methods: {
    onSearch() {
      this.$router.push("/search")
      console.log('111');
    },
    GO() {
      if(this.flag===0){
        this.$router.push("/login");
      }else{
        this.$router.push("/user");
      }
      
    },
  },
};
</script>
<style scoped>
.search {
  height: 50px;
  width: 200px;
}
.van-search {
  display: flex;
}
div {
  font-size: 16px;
  color: white;
  padding-right: 6px;
}
div:last-child {
  padding-right: 0px;
}
</style>
